package com.gz.tank;

import java.util.Vector;

public class Hero extends Tank {
    Vector<Shot> shots=new Vector<>();
    Shot shot=null;

    public Hero(int x, int y) {
        super(x, y);
    }

    public void myshot(){
        if(shots.size()==5) //在子弹命中或到达边界前，只能发送5次
            return;
        switch (getDirect()){
            case 0:
                shot = new Shot(getX()+20,getY(),0);
                break;
            case 1:
                shot = new Shot(getX()+40,getY()+20,1);
                break;
            case 2:
                shot = new Shot(getX()+20,getY()+60,2);
                break;
            case 3:
                shot = new Shot(getX()-20,getY()+20,3);
        }
        shots.add(shot);
        new Thread(shot).start();//射击我方子弹
    }
}
